<?php
/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2020/5/1
 * Time: 11:22
 */

namespace agent\behavior;


use think\Config;
use think\Hook;

class Init
{
    public function appInit()
    {
        Hook::import($this->getTags());
        Config::load($this->getConfigs());
    }

    public function appBegin(){

    }

    private function setMenus()
    {
        $menus = Config::get('menus');
        $menus['user'] = [
            'name' => '用户管理',
            'icon' => 'icon-user',
            'index' => 'user/index',
            'submenu' => [
                [
                    'name' => '用户列表',
                    'index' => 'user/index'
                ]
            ]
        ];
        $menus['agent'] = [
            'name' => '代理级别',
            'icon' => 'am-icon-user-secret',
            'index' => 'agent/agent/index',
            'submenu' => [
                [
                    'name' => '级别列表',
                    'index' => 'agent/index'
                ]
            ]
        ];
        Config::set("menus", $menus);
    }

    private function getTags()
    {
        return include EXTEND_PATH . 'agent/tags.php';
    }

    private function getConfigs()
    {
        return EXTEND_PATH . 'agent/config.php';
    }
}